﻿namespace Dissemination.MVC.Logging.Log4Net
{
    using System;
    using log4net;

    public class Log4NetLogger : ILogger
    {

        private static ILog log;

        public Log4NetLogger()
        {
            log = LogManager.GetLogger(typeof(Log4NetLogger));
            log4net.Config.XmlConfigurator.Configure();
        }

        #region ILogger Members

        public void Info(string message)
        {
            log.Info(message);
        }

        public void Warn(string message)
        {
            log.Warn(message);
        }

        public void Debug(string message)
        {
            log.Debug(message);
        }

        public void Error(string message)
        {
            log.Error(message);
        }

        public void Error(Exception x)
        {
            Error(LogUtility.BuildExceptionMessage(x));
        }

        public void Fatal(string message)
        {
            log.Fatal(message);
        }

        public void Fatal(Exception x)
        {
            Fatal(LogUtility.BuildExceptionMessage(x));
        }

        #endregion

    }   // End Class

}       // End Namespace
